<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keyword" content="">

    <link rel="shortcut icon" href="/node-mongodb-native/3.3/img/favicon.png">

    <title>Quick Start</title>

    <link rel="stylesheet" href="/node-mongodb-native/3.3/lib/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native/3.3/lib/font-awesome/css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native/3.3/css/mongodb-docs.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native/3.3/css/overrides.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native/3.3/lib/highlight/styles/idea.css" />
<link rel="stylesheet" href="/node-mongodb-native/3.3/lib/bootstrap-toggle/bootstrap-toggle.min.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native/3.3/css/java.css" type="text/css" />


  </head>

  <body>
  
  <section id="container" class="">
      
      <header id="header-db" class="row" role="navigation">
  <div class="header-content">
    <div class="toggle-nav pull-left">
        <i class="fa fa-bars"></i>
        <div class="icon-reorder tooltips" data-original-title="Toggle Navigation" data-placement="bottom"></div>
    </div>
    
    <div class="logo pull-left">
      <a href="https://www.mongodb.com/">
        <img src="https://mongodb.github.io/node-mongodb-native/img/logo-mongodb-header.png", alt="MongoDB.com" />
      </a>
    </div>
    
    <div>
<div class="nav-items pull-right">
  <a href="https://university.mongodb.com" data-toggle="tooltip" data-placement="bottom" title="Free Online Classes">MongoDB University</a>
  <a href="https://www.mongodb.com/try" data-toggle="tooltip" data-placement="bottom" title="Download MongoDB">Downloads</a>
  <a href="https://www.mongodb.com/community" data-toggle="tooltip" data-placement="bottom" title="Get involved with MongoDB">Community</a>
  <a href="https://www.mongodb.com/docs" data-toggle="tooltip" data-placement="bottom" title="The MongoDB Documentation">Docs</a>
  <a href="https://www.mongodb.com/blog" data-toggle="tooltip" data-placement="bottom" title="The MongoDB Blog">Blog</a>
  <div id="search">
<form method="get" action="//www.google.com/search" target="_blank">
    <input type="text" name="searchQuery" size="20" value="" autocomplete="off" placeholder="Search docs">
    <input type="hidden" name="site" value="/node-mongodb-native/3.3">
    <input type="hidden" name="q" value="">
    <label for="searchQuery"><i class="fa fa-search fa-1"></i></label>
</form>
</div>

</div>
</div>

  </div>
</header>


      

      
<aside id="sidebar" class="sidebar">
    <div class="ssidebar nav-collapse">
      <div class="ssidebarwrapper">
        <h3>
          <a class="index-link" href="/node-mongodb-native/3.3/../">MongoDB Node.js Driver</a>
          <a class="version pull-right" href="/node-mongodb-native/3.3">3.3</a>
        </h3>

        
        <ul class="sidebar-menu">
          
          
          
          
          
          
          
          
          
          
          
          

          
          
            
            









  


          
            
            









  
  
  
  
  
  
  
  

  


          
            
            









  
    
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
    
  


          
            
            









  
    
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
    
  


          
            
            









  
    
    
      
      
    
    
  


          
            
            









  


          
            
            









  


          
            
            









  


          
            
            









  


          

          

          
            
            
















    <li class="toctree-l1">
    <a href="/node-mongodb-native/3.3/installation-guide/installation-guide/">
        <i class='fa fa-puzzle-piece'></i>
        Installation Guide
    </a>
  </li>


          
            
            













  




    <li class="toctree-l1">
    <a href="/node-mongodb-native/3.3/quick-start/quick-start/">
        <i class='fa fa-road'></i>
        Quick Start
    </a>
  </li>


          
            
            
















<li class="toctree-l1 ">
  <a href="/node-mongodb-native/3.3/tutorials/main/" class="">
      <i class='fa fa-thumb-tack'></i>
      <span>Tutorials</span>
      <span class="menu-arrow fa fa-angle-right"></span>
  </a>
    <ul >
        
        
        
        
















<li class="toctree-l2 ">
  <a href="/node-mongodb-native/3.3/tutorials/connect/" class="">
      <i class='fa'></i>
      <span>Connect to MongoDB</span>
      
  </a>
    <ul >
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/tutorials/connect/authenticating/">
        <i class='fa'></i>
        Authentication
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/tutorials/connect/ssl/">
        <i class='fa'></i>
        SSL Settings
    </a>
  </li>


        
        
    </ul>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/collations/">
        <i class='fa'></i>
        Collations
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/collections/">
        <i class='fa'></i>
        Collections
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/create-indexes/">
        <i class='fa'></i>
        Create Indexes
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/crud/">
        <i class='fa'></i>
        CRUD Operations
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/projections/">
        <i class='fa'></i>
        Projections
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/aggregation/">
        <i class='fa'></i>
        Aggregation
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/text-search/">
        <i class='fa'></i>
        Text Search
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/geospatial-search/">
        <i class='fa'></i>
        Geospatial Search
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/tutorials/commands/">
        <i class='fa'></i>
        Database Commands
    </a>
  </li>


        
        
        
        
        
















<li class="toctree-l2 ">
  <a href="/node-mongodb-native/3.3/tutorials/gridfs/" class="">
      <i class='fa'></i>
      <span>GridFS</span>
      
  </a>
    <ul >
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/tutorials/gridfs/streaming/">
        <i class='fa'></i>
        GridFS API
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/tutorials/gridfs/gridstore/">
        <i class='fa'></i>
        Legacy GridStore
    </a>
  </li>


        
        
    </ul>
  </li>


        
        
    </ul>
  </li>


          
            
            
















<li class="toctree-l1 ">
  <a href="/node-mongodb-native/3.3/reference/main/" class="">
      <i class='fa fa-book'></i>
      <span>Reference</span>
      <span class="menu-arrow fa fa-angle-right"></span>
  </a>
    <ul >
        
        
        
        
















<li class="toctree-l2 ">
  <a href="/node-mongodb-native/3.3/reference/connecting/" class="">
      <i class='fa'></i>
      <span>Connection Options</span>
      
  </a>
    <ul >
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/reference/connecting/connection-settings/">
        <i class='fa'></i>
        Connection Settings
    </a>
  </li>


        
        
    </ul>
  </li>


        
        
        
        
        
















<li class="toctree-l2 ">
  <a href="/node-mongodb-native/3.3/reference/ecmascriptnext/" class="">
      <i class='fa'></i>
      <span>ECMAScript Next</span>
      
  </a>
    <ul >
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/reference/ecmascriptnext/connecting/">
        <i class='fa'></i>
        Connecting
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/reference/ecmascriptnext/crud/">
        <i class='fa'></i>
        CRUD Operations
    </a>
  </li>


        
        
    </ul>
  </li>


        
        
        
        
        
















<li class="toctree-l2 ">
  <a href="/node-mongodb-native/3.3/reference/management/" class="">
      <i class='fa'></i>
      <span>Management</span>
      
  </a>
    <ul >
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/reference/management/logging/">
        <i class='fa'></i>
        Logging
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/reference/management/apm/">
        <i class='fa'></i>
        APM
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l3">
    <a href="/node-mongodb-native/3.3/reference/management/sdam-monitoring/">
        <i class='fa'></i>
        Topology Monitoring
    </a>
  </li>


        
        
    </ul>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/reference/cursors/">
        <i class='fa'></i>
        Cursors
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/reference/pool/">
        <i class='fa'></i>
        Pool Design
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/reference/unified-topology/">
        <i class='fa'></i>
        Unified Topology Design
    </a>
  </li>


        
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/reference/faq/">
        <i class='fa'></i>
        Frequently Asked Questions
    </a>
  </li>


        
        
    </ul>
  </li>


          
            
            
















<li class="toctree-l1 ">
  <a href="/node-mongodb-native/3.3/upgrade-migration/main/" class="">
      <i class='fa fa-cog'></i>
      <span>Upgrade Guide</span>
      <span class="menu-arrow fa fa-angle-right"></span>
  </a>
    <ul >
        
        
        
        
















    <li class="toctree-l2">
    <a href="/node-mongodb-native/3.3/upgrade-migration/upgrading/">
        <i class='fa fa-wrench'></i>
        Upgrading to 2.x
    </a>
  </li>


        
        
    </ul>
  </li>


          
            
            
















    <li class="toctree-l1">
    <a href="/node-mongodb-native/3.3/api">
        <i class='fa fa-file-text-o'></i>
        API Documentation
    </a>
  </li>


          
            
            
















    <li class="toctree-l1">
    <a href="https://github.com/mongodb/node-mongodb-native">
        <i class='fa fa-github'></i>
        Source Code
    </a>
  </li>


          
            
            
















    <li class="toctree-l1">
    <a href="/node-mongodb-native/3.3/issues-help/">
        <i class='fa fa-life-ring'></i>
        Issues &amp; Help
    </a>
  </li>


          
            
            
















    <li class="toctree-l1">
    <a href="https://gitter.im/mongodb/node-mongodb-native?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge">
        <img src='https://badges.gitter.im/Join Chat.svg'/>
        
    </a>
  </li>


          
        </ul>
        
    </div>
  </div>
  
</aside>

<div class="option-popup closed hidden" id="optionsVersionsPopup">
<div class="option-header">
  <i class="fa fa-gear"></i>
  <span>OPTIONS</span>
  <i class="fa fa-angle-up pull-right"></i>
</div>
<div class="option-body">
  <ul>
      
      <li>
        <label>Version</label>
        <div class="btn-group btn-group-xs pull-right">
          <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
            Select Version <span class="caret"></span>
          </button>
          <ul class="dropdown-menu" role="menu" id="optionsVersionsMenu">
          </ul>
        </div>
      </li>

   


    

  </ul>
</div>
</div>



      
      <section id="main-content" class="content">
          <section class="main-column pull-left">
            <div class="document">
              <div class="documentwrapper">
                <div class="bodywrapper">
                  <div class="body">

                    <div class="alert alert-info" role="alert">
  Note: You are currently viewing version 3.3 of the Node.js driver documentation.
  <a href="https://www.mongodb.com/docs/drivers/node">Click here</a> for the latest version.
</div>



   
<a class="edit-link" href="https://github.com/mongodb/node-mongodb-native/blob/master/docs/reference/content/quick-start/quick-start.md" target="_blank" title="Edit quick-start/quick-start.md on GitHub"><i class="fa fa-pencil-square-o"></i></a>










<div class="bc">
<ul>
  
  
  
  
  
  
  <li>Quick Start</li>
</ul>
</div>




<h1 id="quick-start">Quick Start</h1>

<p>This guide will show you how to set up a simple application using Node.js and MongoDB. Its scope is only how to set up the driver and perform the simple CRUD operations. For more in-depth coverage, see the <a href="/node-mongodb-native/3.3/reference/main/">tutorials</a>.</p>

<h2 id="create-the-package-json-file">Create the package.json file</h2>

<p>First, create a directory where your application will live.</p>

<pre><code>mkdir myproject
cd myproject
</code></pre>

<p>Enter the following command and answer the questions to create the initial structure for your new project:</p>

<pre><code>npm init
</code></pre>

<p>Next, install the driver dependency.</p>

<pre><code>npm install mongodb --save
</code></pre>

<p>You should see <strong>NPM</strong> download a lot of files. Once it&rsquo;s done you&rsquo;ll find all the downloaded packages under the <strong>node_modules</strong> directory.</p>

<h2 id="start-a-mongodb-server">Start a MongoDB Server</h2>

<p>For complete MongoDB installation instructions, see <a href="https://www.mongodb.com/docs/manual/installation/">the manual</a>.</p>

<ol>
<li>Download the right MongoDB version from <a href="https://www.mongodb.org/downloads">MongoDB</a></li>
<li>Create a database directory (in this case under <strong>/data</strong>).</li>
<li>Install and start a <code>mongod</code> process.</li>
</ol>

<pre><code>mongod --dbpath=/data
</code></pre>

<p>You should see the <strong>mongod</strong> process start up and print some status information.</p>

<h2 id="connect-to-mongodb">Connect to MongoDB</h2>

<p>Create a new <strong>app.js</strong> file and add the following code to try out some basic CRUD
operations using the MongoDB driver.</p>

<p>Add code to connect to the server and the database <strong>myproject</strong>:</p>

<pre><code class="language-js">const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');

// Connection URL
const url = 'mongodb://localhost:27017';

// Database Name
const dbName = 'myproject';

// Create a new MongoClient
const client = new MongoClient(url);

// Use connect method to connect to the Server
client.connect(function(err) {
  assert.equal(null, err);
  console.log("Connected successfully to server");

  const db = client.db(dbName);

  client.close();
});

</code></pre>

<p>Run your app from the command line with:</p>

<pre><code>node app.js
</code></pre>

<p>The application should print <strong>Connected successfully to server</strong> to the console.</p>

<h2 id="insert-a-document">Insert a Document</h2>

<p>Add to <strong>app.js</strong> the following function which uses the <strong>insertMany</strong>
method to add three documents to the <strong>documents</strong> collection.</p>

<pre><code class="language-js">const insertDocuments = function(db, callback) {
  // Get the documents collection
  const collection = db.collection('documents');
  // Insert some documents
  collection.insertMany([
    {a : 1}, {a : 2}, {a : 3}
  ], function(err, result) {
    assert.equal(err, null);
    assert.equal(3, result.result.n);
    assert.equal(3, result.ops.length);
    console.log(&quot;Inserted 3 documents into the collection&quot;);
    callback(result);
  });
}
</code></pre>

<p>The <strong>insert</strong> command returns an object with the following fields:</p>

<ul>
<li><strong>result</strong> Contains the result document from MongoDB</li>
<li><strong>ops</strong> Contains the documents inserted with added <strong>_id</strong> fields</li>
<li><strong>connection</strong> Contains the connection used to perform the insert</li>
</ul>

<p>Add the following code to call the <strong>insertDocuments</strong> function:</p>

<pre><code class="language-js">const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');

// Connection URL
const url = 'mongodb://localhost:27017';

// Database Name
const dbName = 'myproject';
const client = new MongoClient(url, {useNewUrlParser: true});

// Use connect method to connect to the server
client.connect(function(err) {
  assert.equal(null, err);
  console.log(&quot;Connected successfully to server&quot;);

  const db = client.db(dbName);

  insertDocuments(db, function() {
    client.close();
  });
});
</code></pre>

<p>Run the updated <strong>app.js</strong> file:</p>

<pre><code>node app.js
</code></pre>

<p>The operation returns the following output:</p>

<pre><code>Connected successfully to server
Inserted 3 documents into the collection
</code></pre>

<h2 id="find-all-documents">Find All Documents</h2>

<p>Add a query that returns all the documents.</p>

<pre><code class="language-js">const findDocuments = function(db, callback) {
  // Get the documents collection
  const collection = db.collection('documents');
  // Find some documents
  collection.find({}).toArray(function(err, docs) {
    assert.equal(err, null);
    console.log(&quot;Found the following records&quot;);
    console.log(docs)
    callback(docs);
  });
}
</code></pre>

<!---
Changed console.dir to console.log, since most users will be running these examples from the command line
rather than from within a browser console, and console.log returns better formatting.
-->

<p>This query returns all the documents in the <strong>documents</strong> collection. Add the <strong>findDocument</strong> method to the <strong>client.connect</strong> callback:</p>

<!---
Removed the assert line for number of documents returned on the grounds that it's too brittle.
It's better if these code examples are idempotent, and if this one
is run repeatedly the number of documents in the collection will change.
-->

<pre><code class="language-js">const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');

// Connection URL
const url = 'mongodb://localhost:27017';

// Database Name
const dbName = 'myproject';

const client = new MongoClient(url);
// Use connect method to connect to the server
client.connect(function(err) {
  assert.equal(null, err);
  console.log(&quot;Connected correctly to server&quot;);

  const db = client.db(dbName);

  insertDocuments(db, function() {
    findDocuments(db, function() {
      client.close();
    });
  });
});
</code></pre>

<h2 id="find-documents-with-a-query-filter">Find Documents with a Query Filter</h2>

<p>Add a query filter to find only documents which meet the query criteria.</p>

<pre><code class="language-js">const findDocuments = function(db, callback) {
  // Get the documents collection
  const collection = db.collection('documents');
  // Find some documents
  collection.find({'a': 3}).toArray(function(err, docs) {
    assert.equal(err, null);
    console.log(&quot;Found the following records&quot;);
    console.log(docs);
    callback(docs);
  });
}
</code></pre>

<p>Only the documents which match <code>'a' : 3</code> should be returned.</p>

<h2 id="update-a-document">Update a document</h2>

<p>The following operation updates a document in the <strong>documents</strong> collection.</p>

<pre><code class="language-js">const updateDocument = function(db, callback) {
  // Get the documents collection
  const collection = db.collection('documents');
  // Update document where a is 2, set b equal to 1
  collection.updateOne({ a : 2 }
    , { $set: { b : 1 } }, function(err, result) {
    assert.equal(err, null);
    assert.equal(1, result.result.n);
    console.log(&quot;Updated the document with the field a equal to 2&quot;);
    callback(result);
  });  
}
</code></pre>

<p>The method updates the first document where the field <strong>a</strong> is equal to <strong>2</strong> by adding a new field <strong>b</strong> to the document set to <strong>1</strong>. Next, update the callback function from <strong>client.connect</strong> to include the update method.</p>

<pre><code class="language-js">const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');

// Connection URL
const url = 'mongodb://localhost:27017';

// Database Name
const dbName = 'myproject';

const client = new MongoClient(url);
// Use connect method to connect to the server
client.connect(function(err) {
  assert.equal(null, err);
  console.log(&quot;Connected successfully to server&quot;);

  const db = client.db(dbName);

  insertDocuments(db, function() {
    updateDocument(db, function() {
      client.close();
    });
  });
});
</code></pre>

<h2 id="remove-a-document">Remove a document</h2>

<p>Remove the document where the field <strong>a</strong> is equal to <strong>3</strong>.</p>

<pre><code class="language-js">const removeDocument = function(db, callback) {
  // Get the documents collection
  const collection = db.collection('documents');
  // Delete document where a is 3
  collection.deleteOne({ a : 3 }, function(err, result) {
    assert.equal(err, null);
    assert.equal(1, result.result.n);
    console.log(&quot;Removed the document with the field a equal to 3&quot;);
    callback(result);
  });    
}
</code></pre>

<p>Add the new method to the <strong>client.connect</strong> callback function.</p>

<pre><code class="language-js">const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');

// Connection URL
const url = 'mongodb://localhost:27017';

// Database Name
const dbName = 'myproject';

const client = new MongoClient(url);
// Use connect method to connect to the server
client.connect(function(err) {
  assert.equal(null, err);
  console.log(&quot;Connected successfully to server&quot;);

  const db = client.db(dbName);

  insertDocuments(db, function() {
    updateDocument(db, function() {
      removeDocument(db, function() {
        client.close();
      });
    });
  });
});
</code></pre>

<h2 id="index-a-collection">Index a Collection</h2>

<p><a href="https://www.mongodb.com/docs/manual/indexes/">Indexes</a> can improve your application&rsquo;s
performance. The following function creates an index on the <strong>a</strong> field in the
<strong>documents</strong> collection.</p>

<pre><code class="language-js">const indexCollection = function(db, callback) {
  db.collection('documents').createIndex(
    { "a": 1 },
      null,
      function(err, results) {
        console.log(results);
        callback();
    }
  );
};
</code></pre>

<p>Add the <code>indexCollection</code> method to your app:</p>

<pre><code class="language-js">const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');

// Connection URL
const url = 'mongodb://localhost:27017';

const dbName = 'myproject';

const client = new MongoClient(url);
// Use connect method to connect to the server
client.connect(function(err) {
  assert.equal(null, err);
  console.log(&quot;Connected successfully to server&quot;);

  const db = client.db(dbName);

  insertDocuments(db, function() {
    indexCollection(db, function() {
      client.close();
    });
  });
});
</code></pre>

<p>For more detailed information, see the <a href="/node-mongodb-native/3.3/tutorials/main/">tutorials</a>.</p>






<div id="btnv">
  
  
</div>
</div>


</div>
<div class="right-column">
<div class="wrapper">
  
  <div class="toc">
    <span class="toc-header">On this page</span>
    <nav id="TableOfContents">
<ul>
<li><a href="#quick-start">Quick Start</a>
<ul>
<li><a href="#create-the-package-json-file">Create the package.json file</a></li>
<li><a href="#start-a-mongodb-server">Start a MongoDB Server</a></li>
<li><a href="#connect-to-mongodb">Connect to MongoDB</a></li>
<li><a href="#insert-a-document">Insert a Document</a></li>
<li><a href="#find-all-documents">Find All Documents</a></li>
<li><a href="#find-documents-with-a-query-filter">Find Documents with a Query Filter</a></li>
<li><a href="#update-a-document">Update a document</a></li>
<li><a href="#remove-a-document">Remove a document</a></li>
<li><a href="#index-a-collection">Index a Collection</a></li>
</ul></li>
</ul>
</nav>
  </div>
  
</div>
</div>

</div>
</div>
</div>
</section>
</section>

</section>


<script type="text/javascript">
  var DOCUMENTATION_OPTIONS = {
   URL_ROOT:    "/node-mongodb-native/3.3",
   VERSION:     "3.3",
   COLLAPSE_INDEX: false,
   FILE_SUFFIX: '.html',
   HAS_SOURCE:  true
  };
</script>
<script type="text/javascript" src="/node-mongodb-native/3.3/js/jquery.js"></script>
<script type="text/javascript" src="/node-mongodb-native/3.3/lib/bootstrap.js"></script>
<script type="text/javascript" src="/node-mongodb-native/3.3/js/navbar.js"></script>
<script type="text/javascript" src="/node-mongodb-native/3.3/lib/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="/node-mongodb-native/3.3/js/scripts.js"></script>
<script type="text/javascript" src="/node-mongodb-native/3.3/lib/bootstrap-toggle/bootstrap-toggle.min.js"></script>
<script type="text/javascript" src="/node-mongodb-native/3.3/js/java.js"></script>
<script type="text/javascript" src="/node-mongodb-native/3.3/js/toggle-switch.js"></script>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-29229787-1', 'auto');
  ga('send', 'pageview');
</script>
</body>
</html>

